<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>11_数组的增-头部增</title>
    </head>
    <body>
        <script>
            //         0 1 2 3 4 5
            // var arr = [1,2,3,4,5];

            // arr[5] = arr[4];
            // arr[4] = arr[3];
            // arr[3] = arr[2];
            // arr[2] = arr[1];
            // arr[1] = arr[0];

            // arr[0] = 0;

            // console.log(arr);


            // 循环
            var arr = [1,2,3,4,5];

            for(var i = arr.length; i >= 1; i--){
                arr[i] = arr[i-1];
            }

            arr[0] = 0;

            console.log(arr);


        </script>
    </body>
</html>